import request from '@/utils/request'

// 查询客户联系记录列表
export function listContactRecord(query) {
  return request({
    url: '/system/contactrecord/list',
    method: 'get',
    params: query
  })
}

// 根据客户ID查询联系记录列表
export function listContactRecordByCaseId(caseId) {
  console.log('API调用: 根据客户ID查询联系记录，客户ID:', caseId);
  return request({
    url: `/system/contactrecord/listByCaseId/${caseId}`,
    method: 'get',
    params: {
      t: new Date().getTime() // 添加时间戳避免缓存问题
    }
  })
}

// 查询客户联系记录详细
export function getContactRecord(recordId) {
  return request({
    url: `/system/contactrecord/${recordId}`,
    method: 'get'
  })
}

// 新增客户联系记录
export function addContactRecord(data) {
  return request({
    url: '/system/contactrecord',
    method: 'post',
    data: data
  })
}

// 修改客户联系记录
export function updateContactRecord(data) {
  return request({
    url: '/system/contactrecord',
    method: 'put',
    data: data
  })
}

// 删除客户联系记录
export function delContactRecord(recordId) {
  return request({
    url: `/system/contactrecord/${recordId}`,
    method: 'delete'
  })
} 